<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script>
        //通过用户输入的参数控制循环的次数
      /*   var count=prompt("请输入循环次数")
        for(var i = 1; i <= count; i++){
            console.log(i);
        } */

        //案例2
     /*    for(var i = 1; i <= 10; i++){
            if(i == 2){
                console.log("循环到2了")
            } else if(i == 5){
                console.log("循环到5了")
            } else{
                console.log("当前i="+i)
            } 
        } */

        //案例3:求1~100的累加
       /*  var sum=0;
        for(var i = 1; i <= 100; i++){
            sum+=i;
        }
        console.log(sum) */

        //案例4：求2~65的平均值
        /* var sum=0;
        var avg=0;
        for(var i = 2; i <= 65; i++){
            sum+=i;
        }
        avg=sum/64
        console.log(avg) */

        //案例5：求1~100之间所有能被5整除的数字的和
        var result = 0;
        for(var i = 1; i <= 100; i++){
            if(i % 5 == 0){
                result += i;
            }
        }
        console.log(result)

    </script>
</head>
<body>
    
</body>
</html>